cmake_minimum_required(VERSION 3.10)
project(rlottiedemo)

set(CMAKE_C_STANDARD 99)#C99 # lvgl officially support C99 and above
set(CMAKE_CXX_STANDARD 17)#C17
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (AM335X_PLATFORM)

set(Libdrm_LIBRARIES drm)
include_directories(${EXTERN_TARGET_DIR}/include/libdrm)
link_directories(${EXTERN_TARGET_DIR}/lib)

else()

find_package(SDL2)
find_package(SDL2_image)
include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS})

endif()

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LVGL_PORT_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})



add_executable(${PROJECT_NAME} main.c mouse_cursor_icon.c)
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})


target_link_libraries(${PROJECT_NAME} lvgl  ${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES} ${Libdrm_LIBRARIES} m pthread)

install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/emoji_wink.json DESTINATION ${CMAKE_INSTALL_PREFIX}/resources/lotties)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lv_example_rlottie_approve.json DESTINATION ${CMAKE_INSTALL_PREFIX}/resources/lotties)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mask.json DESTINATION ${CMAKE_INSTALL_PREFIX}/resources/lotties)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/happy.json DESTINATION ${CMAKE_INSTALL_PREFIX}/resources/lotties)
